package Model;

import java.util.ArrayList;

public class Term {
	
	private String path;
	private String doc;
	private String mot;
	private double poids;
	private boolean isInTitle;
	private ArrayList<Position> positions;
	
	public Term(String p, String d, String m)
	{
		positions = new ArrayList();
		path = p;
		doc = d;
		mot = m;
		isInTitle = false;
		poids = 0;
	}
	public ArrayList<Position> getPositions() {
		return positions;
	}
	public void setPositions(ArrayList<Position> positions) {
		this.positions = positions;
	}
	public void addPosition(int p,String mot, String termSuivant)
	{
		positions.add(new Position(p,mot, termSuivant));
	}
	public int getFrequence()
	{
		return positions.size();
	}
	public String getPath() {
		return path;
	}
	public void setPath(String path) {
		this.path = path;
	}
	public String getDoc() {
		return doc;
	}
	public void setDoc(String doc) {
		this.doc = doc;
	}
	public String getMot() {
		return mot;
	}
	public void setMot(String mot) {
		this.mot = mot;
	}
	public double getPoids() {
		return poids;
	}
	public void setPoids(double d) {
		this.poids = d;
	}
	public boolean isInTitle() {
		return isInTitle;
	}
	public void setInTitle(boolean isInTitle) {
		this.isInTitle = isInTitle;
	}
	public Term getTermContain(ArrayList<Term> terms)
	{
		for ( Term termTab : terms)
		{
			if(termTab.doc == doc && termTab.path == path && termTab.mot == mot)
			{
				return termTab;
			}
		}
		return null;
	}
	

}
